/*
* @Author: Josh
* @Date:   2019-01-26 15:24:42
* @Last Modified by:   Administrator
* @Last Modified time: 2019-04-14 14:23:05
*/
'use steict'
require('page/common/nav/index.js');
require('page/common/header/index.js');
require('./index.css');
var navSide       = require('page/common/nav-side/index.js'),
    _mall         = require('util/mall.js'),
    _user         = require('service/user-service.js'),
    templateIndex = require('./index.string');

//page 逻辑部分
var page = {
    init : function(){
        this.onLoad();
    },
    onLoad : function(){
        //初始化左侧菜单
        navSide.init({
            name : 'user-center'
        });
        //加载用户信息
        this.loadUserInfo()
    },
    //加载用户信息
    loadUserInfo : function(){
        var userHtml = '';
        _user.getUserInfo(function(res){
            userHtml = _mall.renderHtml(templateIndex, res);
            $('.panel-body').html(userHtml);
            $('.panel').addClass('onLogin');
        }, function(errMsg){
            _mall.errorTips(errMsg);
        });
    }
};
    
$(function(){
    page.init(); 
});